package com.campus.web.controller;

import com.alibaba.fastjson.JSON;
import com.campus.app.service.GoodClassService;
import com.campus.commons.entity.GoodClass;
import com.campus.commons.utils.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 * 统计班级情况
 * </p>
 *
 * @author 一行琉璃
 * @since 2021-02-01
 */
@RestController
@RequestMapping("/GoodController")
public class GoodController {
    @Autowired
    private GoodClassService goodClassService;

    @RequestMapping("/goodClass")
    public Result<List<GoodClass>> goodClass(int isRed, int work, String beginTime, String endTime, int page, int limit) {
        Result<List<GoodClass>> result = goodClassService.GoodClass(isRed, work, beginTime, endTime, page, limit);
        return result;
    }

    @RequestMapping("/weekAndMonth")
    public Result<List<GoodClass>> weekMonth(int page, int limit, String beginTime, String endTime) {
        Result<List<GoodClass>> result = goodClassService.monthlyAndWeekStatistics(page, limit, beginTime, endTime);
        System.out.println(JSON.toJSONString(result));

        return result;
    }
}
